﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication1
{
    public class TestModules:IHttpModule
    {
        public void Dispose()
        {

        }

        ///<summary>
        ///
        ///<param name="application"></param>
        public void Init(HttpApplication application)
        {
            application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
            application.EndRequest += (new EventHandler(this.Application_EndRequest));
        }
        ///<summary>
        ///
        ///<param name="source"></param>
        ///<param name="e"></param>
        private void Application_BeginRequest(Object source, EventArgs e)
        {
            HttpApplication application = (HttpApplication)source;
            HttpContext context = application.Context;
            context.Response.Write("<h1><font color=red>HTTP开始</font></h1>");
        }
        ///<summary>
        ///    ///</summary>
        ///<param name="source"></param>
        ///<param name="e"></param>
        private void Application_EndRequest(Object source, EventArgs e)
        {
            HttpApplication application = (HttpApplication)source;
            HttpContext context = application.Context;
            context.Response.Write("<hr><h1><font color=red>HTTP结束</font></h1>");
        }
    }
}